import time
import json
import datetime

class Solution:
    def dayOfYear(self, date: str) -> int:
        # y, m, d = map(int, date.split('-'))
        # year, month, day = [int(x) for x in date.split("-")]
        print(time.strptime(date, "%Y-%m-%d"))
        print(datetime.datetime.strptime(date,"%Y-%m-%d"))
        print(datetime.datetime.strptime(date,"%Y-%m-%d").timetuple())
        print(datetime.datetime.strptime(date,"%Y-%m-%d").timetuple().tm_yday)
        print(datetime.datetime.strptime(date,"%Y-%m-%d").timetuple()[-2])

        return time.strptime(date, "%Y-%m-%d")[-2]

class SolutionTwo:
    def dayOfYear(self, date: str) -> int:
        isLeap = lambda y: y%400 == 0 or (y%4 == 0 and y%100 != 0)
        y, m, d = int(date[:4]), int(date[5:7]), int(date[8:])
        month = [31, 29 if isLeap(y) else 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
        return sum(month[:m-1])+d

class SolutionThree:
    def dayOfYear(self, date: str) -> int:
        year, month, day = [int(x) for x in date.split("-")]

        amount = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
        if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
            amount[1] += 1

        ans = sum(amount[:month - 1])
        return ans + day


if __name__ == '__main__':
    date = json.loads(input().strip())
    print(Solution().dayOfYear(date))